package com.isoft.farm.common;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    //此注解描述的方法为springMVC中的异常处理方法
    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public JsonResult doHandlerRuntimeException(RuntimeException e){
        e.printStackTrace();
        return new JsonResult(e);

    }
}
